﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Supersense.db;
/// <summary>
/// Users 的摘要说明
/// </summary>
/// 
namespace Supersense.users{
    public class Users
    {
        public Database db = new Database();

        public Users()
        {
            //
            // TODO: 在此处添加构造函数逻辑
            //
        }

        public bool update_user(string user, string password, string name)
        {
            string sql = "UPDATE sup_username SET password='" + password + "',name='" + name + "' WHERE username = '" + user + "'";
            if (this.db.executesql(sql))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public DataTable get_user(string user)
        {
            string sql = "SELECT * FROM sup_username WHERE username = '" + user + "'";
            DataView dv = this.db.executedv(sql);
            if (dv != null)
            {
                DataTable dt = dv.Table;
                return dt;
            }
            else
            {
                return null;
            }
        }
    }
}
